package stu.sup.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import stu.sup.entity.CommentReply;
import stu.sup.entity.CommentReplyExample;
import stu.sup.entity.ProductComment;
import stu.sup.mapper.CommentReplyMapper;
import stu.sup.service.ICommentReplyService;

import javax.xml.stream.events.Comment;
import java.util.List;

/**
 * Created by HUAWEI on 2020/6/27.
 */
@Service
@Transactional
public class CommentReplyServiceImpl implements ICommentReplyService{
    @Autowired
    CommentReplyMapper commentReplyMapper;
    @Override
    public int addreply(CommentReply commentReply) {
        return commentReplyMapper.insert(commentReply);
    }

    @Override
    public int delaterepiy(int replyid) {
        return commentReplyMapper.deleteByPrimaryKey(replyid);
    }

    @Override
    public List<CommentReply> selectbycommentId(ProductComment productComment) {
        CommentReplyExample commentReplyExample=new CommentReplyExample();
        CommentReplyExample.Criteria criteria=commentReplyExample.createCriteria();
        criteria.andCommentIdEqualTo(productComment.getCommentId());
        return commentReplyMapper.selectByExample(commentReplyExample);
    }
}
